#!/bin/bash
# ffsb installer
###SHELLPACK preamble ffsb-install 6.0-rc2
MIRROR_LOCATION="$WEBROOT/ffsb/"

###SHELLPACK parseargBegin
###SHELLPACK parseargEnd

WEB_LOCATION=https://downloads.sourceforge.net/project/ffsb/ffsb
###SHELLPACK sources_fetch ffsb-${VERSION}/ffsb-${VERSION}.tar.bz2 ffsb-${VERSION}

###SHELLPACK build_start ffsb-${VERSION}
echo '--- ffsb-6.0-rc2-orig/parser.c	2008-10-27 20:17:05.000000000 +0000
+++ ffsb-6.0-rc2/parser.c	2013-11-06 16:28:17.897964902 +0000
@@ -203,9 +203,9 @@
 	len = strnlen(string, BUFSIZE);
 	sprintf(search_str, "%s=%%%ds\\n", string, BUFSIZE - len-1);
 	if (1 == sscanf(line, search_str, &temp)) {
-		len = strnlen(temp, 4096);
-		ret_buf = malloc(len);
-		strncpy(ret_buf, temp, len);
+		len = strnlen(temp, BUFSIZE - len);
+		ret_buf = malloc(len + 1);
+		strncpy(ret_buf, temp, len + 1);
 		return ret_buf;
 		}
 	free(line);' | patch -p1 || exit $SHELLPACK_ERROR
###SHELLPACK build_configure ffsb-${VERSION}
###SHELLPACK make_make_install

echo ffsb installed successfully
